const {
    defineConfig
} = require('@vue/cli-service')
const AutoImport = require('unplugin-auto-import/webpack')
const Components = require('unplugin-vue-components/webpack')
const {
    ElementPlusResolver
} = require('unplugin-vue-components/resolvers')
const path = require('path')
module.exports = defineConfig({
    transpileDependencies: true,
    devServer: {
        // 配置允许使用域名访问
        allowedHosts: ['www.corho.com']
    },
    // 这个是设置外部扩展，模块为qc变量名为QC，导入qc将不做打包。
    configureWebpack: {
        externals: {
            qc: 'QC'
        },
        // elmentUi的插件配置
        plugins: [
            AutoImport({
                resolvers: [ElementPlusResolver()]
            }),
            Components({
                resolvers: [ElementPlusResolver()]
            })
        ]
    },
    pluginOptions: {
        'style-resources-loader': {
            preProcessor: 'less',
            patterns: [
                path.join(__dirname, './src/assets/styles/variables.less'),
                path.join(__dirname, './src/assets/styles/mixins.less')
            ]
        }
    }
})